package com.dly2024.soft.controller;

import com.dly2024.soft.dto.UserDTO;
import com.dly2024.soft.service.serviceImpl.TestTableServiceImpl;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.Map;

@RestController
@Api
@RequestMapping("/testtable")
public class TestTableController {

    String s = "";

    @Resource
    private TestTableServiceImpl testTableService;

    @GetMapping("/selectUsers")
    public Map<String, Object> selectUsers(@RequestParam int page, @RequestParam int limit,
                                           @RequestParam String username, @RequestParam String password) {
        return testTableService.selectUsers(page, limit, username, password);
    }

    @PostMapping("/s")
    public String s(String wd) {
        return "";
    }

//    @PostMapping("/insert")
//    public Map<String, Object> insert(@RequestParam String username, @RequestParam String password) {
//        return testTableService.insert(username, password);
//    }

    @PostMapping("/insert")
    public Map<String, Object> insert(@RequestBody UserDTO userDTO) {
        return testTableService.insert(userDTO);
    }
}
